package org.testis.testdriver;

import org.testis.testdriver.conditions.ConditionEvaluatable;
import org.testis.data.TestStepResultType;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;


/**
 * This class is used to hold HashMap and Name and expected result type of
 * the data that will be applied to the Test Step.
 * 
 * @author barisergun
 */
public class TestDataObject implements ConditionEvaluatable
{

    private TestStepResultType m_expectedRes;
    private String m_dataObjectName;
    private String m_dataObjectId;
    private LinkedHashMap<String, String> m_dataToApply;
    private LinkedHashMap<String, String> m_resultMap;
    private LinkedList<String> m_conditions;

    //Run Time parameters.

    private List<String> m_failedconditions;

    


    public TestDataObject(String dataObjId,
                          String dataObjName,
                          TestStepResultType expResult,
                          LinkedHashMap<String, String> dataApplied,
                          LinkedList<String> conditions)
    {
        m_dataObjectId = dataObjId;
        m_dataObjectName = dataObjName;
        m_expectedRes = expResult;
        m_dataToApply = dataApplied;
        m_conditions = new LinkedList<String>();
        m_conditions = conditions;
        m_failedconditions =new LinkedList<String>();
    }


    /**
     * This method is used to get the HashMap of data that will be applied.
     * 
     * @return LinkedHashMap
     */
    public LinkedHashMap<String, String> getDataToApply()
    {
        return m_dataToApply;
    }


    /**
     * This method is used to set the HashMap of data that will be applied.
     * 
     * @param val LinkedHashMap as <String, String>
     */
    public void setDataToApply(LinkedHashMap<String, String> val)
    {
        this.m_dataToApply = val;
    }


    /**
     * This method is used to get the name of the Data Object.
     * 
     * @return String
     */
    public String getDataObjectName()
    {
        return m_dataObjectName;
    }


    /**
     * This method is used to set the name of the Data Object.
     * 
     * @param val name as String
     */
    public void setDataObjectName(String val)
    {
        this.m_dataObjectName = val;
    }


    /**
     * This method is used to get the expected result type of the Data Object.
     * s
     * @return TestStepResultType expected result type as TestStepResultType
     */
    public TestStepResultType getExpectedRes()
    {
        return m_expectedRes;
    }


    /**
     * This method is used to set the expected result type of the Data Object.
     * 
     * @param val expected result type as TestStepResultType
     */
    public void setExpectedRes(TestStepResultType val)
    {
        this.m_expectedRes = val;
    }

    /**
     * This method is used to get the id of the Data Object.
     * 
     * @return String
     */
    public String getDataObjectId()
    {
        return m_dataObjectId;
    }
    /**
     * This method is used to set the id of the Data Object.
     * 
     * @param dataObjectId
     */

    public void setDataObjectId(String dataObjectId)
    {
        this.m_dataObjectId = dataObjectId;
    }
    
     public LinkedHashMap<String, String> getResultMap()
    {
        return m_resultMap;
    }


    public void setResultMap(LinkedHashMap<String, String> resultmap)
    {
        this.m_resultMap = resultmap;
    }

     public LinkedList<String> getConditions() {
        return m_conditions;
    }

     public void setConditions(LinkedList<String> conditions){
        m_conditions = conditions;
     }

     public List<String> getFailedConditions() {
        return m_failedconditions;
    }
  
    @Override
    public boolean equals(Object obj)
    {
        return this.hashCode() == obj.hashCode();
    }


    @Override
    public int hashCode()
    {
        int hash = 4;
        hash =
            31 * hash +
            (this.m_expectedRes != null ? this.m_expectedRes.hashCode() : 0);
        hash =
            31 * hash +
            (this.m_dataObjectName != null ? this.m_dataObjectName.hashCode() : 0);
        hash =
            31 * hash +
            (this.m_dataObjectId != null ? this.m_dataObjectId.hashCode() : 0);
        hash =
            31 * hash +
            (this.m_dataToApply != null ? this.m_dataToApply.hashCode() : 0);        
        return hash;
    }



    


    
}

